這次要推薦的 slides, 作者是《Learning Behavior-driven Development with JavaScript》一書的作者: Enrique Amodeo
我得老實說,我沒看過這本書,但他這份 slides-《BDD WITH JS:
TOOLS, PATTERNS & ARCHITECTURE》卻是讓我獲益良多,尤其是對 BDD 有興趣的前端工程師,絕對不要錯過這份簡報。
slides位置:http://eamodeorubio.github.io/bdd-with-js/
重點:
① To cucumber or not to cucumber (實例以 cucumber 跟 mocha 的比較)
② No need to test the UI? (到底要不要從 UI 做 end-to-end test)
③ I want my UI tested (怎麼 tradeoff ? 透過 Zombie 來達到 UI test 的可測試性跟速度)
④ Testing xBrowser issues (介紹 karma)
⑤ Maintainable tests (撰寫 gherkin style 的 scenarios 時,記得 focus 行為,擺脫 detail 的 UI 動作與物件;撰寫 cucumber steps 時,不跟 UI 直接耦合,而透過 page object pattern。)
哥早就說過,BDD/TDD web application, page object pattern 一定要搞懂搞好啊!